package juc.thread;


//import lombok.extern.slf4j.Slf4j;

/*
* 统筹规划的简单案例
*
* */
//@Slf4j
public class Test5 {
    public static void main(String[] args) {
        impl();
    }
    public static void impl(){
        Thread t1 = new Thread(() -> {
            try {
                System.out.println("洗水壶...");
                Thread.sleep(1000);
                System.out.println("烧开水");
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "王1");
        Thread t2 = new Thread(() -> {
            try {
                System.out.println("洗茶壶..");
                Thread.sleep(1000);
                System.out.println("洗茶杯...");
                Thread.sleep(2000);
                System.out.println("拿茶叶..");
                Thread.sleep(1000);
                t1.join();
                System.out.println("泡茶");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "王2");
        t1.start();
        t2.start();
//        try {
//            t1.join();
//            t2.join();
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        switch (command){
//            case 0:
//        }
    }
}
